package ThreadManager;

import java.util.Queue;

import JUtil.ios;

public class Threader implements Runnable {
	Boolean mutex = true;
	@Override
	public void run() {
		synchronized (mutex) {
			try {
				if (mutex == true) {
					mutex = false;
					mutex.wait();
				} else {
					mutex = true;
					mutex.notify();
				}
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	};

	public static void main(String args[]) {
		ios.println("main thread begin");
		Threader t = new Threader();
		new Thread(t).start();
		new Thread(t).start();
		new Thread(t).start();
		// ios.println(Thread.activeCount());
		ios.println("main thread end");
	}
}

class RM {
	int share = 100;
	public synchronized int get() {
		return share;
	}
	public synchronized void set(int i) {
		share = i;
	}
}